using UnityEngine;

namespace Gameplay.PVE
{
    public class EnemyMoveBehaviour : MoveBehaviour
    {
        protected override void UpdatePrepare()
        {
            base.UpdatePrepare();
            if (PveGlobalVlues.EnemyRunIntoBattle)
            {
                unit.Data.targetPosition = unit.Data.birthPosition;
                if (Vector3.Distance(unit.Data.birthPosition,unit.Data.position) <= unit.Data.configMoveSpeed * TimeManager.LogicDeltaTime)
                {
                    unit.Data.moveState = 0;
                }
                else
                {
                    unit.Data.moveState = 2;
                }
            }

        }

        protected override void UpdateGame()
        {
            base.UpdateGame();
           
            if (unit.Data.canShowBossWarning)
            {
                if (!unit.Data.hasShowBossWarning && unit.Data.IsInScreen())
                {
                    unit.Data.hasShowBossWarning = true;
                }
            }

            /*if (unit.Data.isElite)
            {
                if (!unit.Data.hasShowBossWarning && unit.Data.IsInScreen())
                {
                    PveManager.Instance.ShowElite(unit.Data.monsterID);
                    unit.Data.hasShowBossWarning = true;
                }
            }*/

            if (!unit.Data.firstTimeShowInScreen)
            {
                if (unit.Data.IsInScreen())
                {
                    unit.Data.firstTimeShowInScreen = true;
                    unit.Transmit(ETransmitType.JoinBattle);
                }
            }
        }
    }
}